//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#ifndef __CFILEOUTPUTSTREAM_H__
#define __CFILEOUTPUTSTREAM_H__

#include "_CFileOutputStream.h"

CarClass(CFileOutputStream)
{
public:
    CARAPI Close();

    CARAPI Flush();

    CARAPI Write(
        /* [in] */ Byte byte);

    CARAPI WriteBuffer(
        /* [in] */ const BufferOf<Byte> & buffer,
        /* [out] */ Int32 * pBytesWritten);

    CARAPI WriteBufferEx(
        /* [in] */ Int32 offset,
        /* [in] */ Int32 length,
        /* [in] */ const BufferOf<Byte> & buffer,
        /* [out] */ Int32 * pBytesWritten);

    CARAPI GetFileInterface(
        /* [out] */ IBasicFile ** ppFile);

    ~CFileOutputStream();

    CARAPI constructor(
        /* [in] */ AString fileName,
        /* [in] */ Boolean append);

    CARAPI constructor(
        /* [in] */ WString fileName,
        /* [in] */ Boolean append);

    CARAPI constructor(
        /* [in] */ IBasicFile * pFile,
        /* [in] */ Boolean append);

    CFileOutputStream() : m_pIab(NULL), m_pos(0) {}

private:
/**
  * write datas to file <code>m_pFile</code>
  *     from the position <code>m_pos</code>
  * by default: data is appended to file
  */
    IAbsoluteIO * m_pIab;
    Int32 m_pos;
};

#endif // __CFILEOUTPUTSTREAM_H__
